<script type="text/javascript">
function lookup(url) {
    if(url.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("<?= site_url('article/user/menu/lookup') ?>", {queryString: ""+url+""}, function(data){
            if(data.length >0) {
                $('#suggestions').show();
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup
</script>

<h2><?php print $header?></h2>
<p><?php print $this->lang->line( 'menu_info' )?></p>

<?php print form_open('article/user/menu/form/', array( 'class' => 'horizontal' ) )?>
    <fieldset>
        <ol>
			<li>
                <?php print form_label( $this->lang->line('menu_url'), 'url')?>
                <?php print form_input( 'url', '', 'id="url" class="text" onkeyup="lookup(this.value);"' )?>
                <div class="suggestionsBox" id="suggestions" style="display: none;">
                <div class="suggestionList" id="autoSuggestionsList">
				</div>
				</div>
            </li>
            <li>
                <?php print form_label( $this->lang->line('menu_title'), 'menu_title' )?>
                <?php print form_input( 'title', '','id="title" class="text"' )?>
            </li>
            <li>
                <?php print form_label( $this->lang->line('menu_guestbook'), 'menu_guestbook' )?>
                <?php print form_dropdown( 'type_id', $guestbook, '','id="type_id" size="10" style="width:20.3em;"' )?>
            </li>
            <li>
                <?php print form_label( $this->lang->line('menu_menu'), 'menu_id' )?>
                <?php print form_dropdown( 'menu_id', $menu_dropdown, '','id="menu_id" size="10" style="width:20.3em;"' )?>
            </li>
            <li>
                <?php print form_label( $this->lang->line( 'menu_active' ), 'active' )?>
                <?php print $this->lang->line( 'general_yes' ) ?> <?php print form_radio( 'active', '1', $this->validation->set_radio( 'active', '1' ), 'id="active"' )?>
                <?php print $this->lang->line( 'general_no' ) ?> <?php print form_radio( 'active', '0', $this->validation->set_radio( 'active', '0' ) )?>
            </li>
            <li class="submit">
                <?php 
                	print form_hidden( 'menu_position_id', $menu_position );
	                print form_hidden( 'position', $this->validation->id );
	                print form_hidden( 'type', 'guestbook' );
                ?>
                <div class="buttons">
	                <button type="submit" class="positive" name="submit" value="submit">
	                	<?php print $this->bep_assets->icon( 'disk' );?>
	                	<?php print $this->lang->line( 'general_save' )?>
	                </button>
	                <a href="<?php print site_url( 'article/user/menu/type/overview' )?>" class="negative">
	                	<?php print $this->bep_assets->icon( 'cross' );?>
	                	<?php print $this->lang->line( 'general_cancel' )?>
	                </a>
	            </div>
            </li>
        </ol>
    </fieldset>
<?php print form_close( )?>
